# @Time    :2025/3/22 9:26
# -------算数运算符---加减乘，除、整除。模，幂-----------


num1 = 10
num2 = 4
print(num1 + num2)
print(num1 - num2)
print(num1 * num2)

print(num1 / num2)  # 除 浮点数结果
print(num1 // num2)  # 整除向下取整

print(num1 % num2)  # 取余数 2
print(num1 ** 2)  # 幂 2次方 100
# -------赋值运算符--- += 、-= 、*=、/= -----------
num3 = 10
num3 += 5  # 等价于num3=num3+5
print(num3)  # 15

num4 = 20
num4 -= 6
print(num4)

num5 = 20
num5 *= 6
print(num5)  # 120

num6 = 20
num6 /= 6  # 浮点数除法
print(num6)  # 3.333

num7 = 20
num7 //= 6  # 整除 向下取整
print(num7)  # 3

# 海象运算符
print((num1 := num2) < num2)
print(num1 := num2)

# -----------------比较运算符-----------------
num1 = 10
num2 = 4
print(num1 == num2)
print(num1 != num2)
print(num1 > num2)
print(num1 < num2)

# -----------------逻辑运算符-----------------

# and   与  ,x and y ,  若x为false 返回x的值，否则返回y的值
# or    或， x  or y,   若x为True 返回x的值，否则返回y的值
# not   非，  not x,    若x 为True 返回False,若x 为False返回True

b1 = False
b2 = True
print(b1 and b2)  # b1的值False
print(b1 or b2)  # True
print("*" * 10)
print(not b1)

print(5 and 8)  # 非0或者 0.1等等0.n 或者None 都视为正数，否则视为0#and  5  是非0的 所以返回8
print(0 and 3)  # 0

print(5 or 8)  # 5
print(0 or 8)  # 8

print(not 1)  # False

# -----------成员运算符-----------------
num1=[12,23,24,11,45]
print(10 in num1)
print(10 not in num1)
print(22 in [12,22,35])
# -----------身份运算符-----------------
m=12
n=12
q=34
print(m is n)#True
print(n is not m)

print(id(m)==id(n))
print(id(m)==id(q))

# -------------is和==的区别---------------
print(n==m)

print("hello world")